<template>
  <BasicModal v-bind="$attrs" @register="registerModal" title="追踪日志" :showOkBtn="false" width="1000px" destroyOnClose>
    <BasicTable @register="registerTable" />
  </BasicModal>
</template>
<script lang="ts" setup>
  import { ref, toRaw, unref } from 'vue';
  import { BasicModal, useModalInner } from '/@/components/Modal';
  import { BasicTable, useTable, TableAction } from '/@/components/Table';
  import { traceColumns } from './trace.data';
  import { getTraceLogList } from './trace.api';
  import { useMessage } from '/@/hooks/web/useMessage';
  const queryStr = ref('');
  const { createConfirm } = useMessage();
  // 声明Emits
  const emit = defineEmits(['success', 'register']);
  const checkedKeys = ref<Array<string | number>>([]);
  const [registerModal] = useModalInner(async (data) => {
    queryStr.value = 'traceId.keyword : ' + data.traceId;
    setProps({
      searchInfo: {
        queryStr: unref(queryStr),
        sortCol: 'timestamp',
        sortOrder: 'ASC',
      },
    });
    reload();
  });

  //注册table数据
  const [registerTable, { reload, setProps }] = useTable({
    api: getTraceLogList,
    columns: traceColumns,
    rowKey: 'id',
    striped: true,
    useSearchForm: false,
    showTableSetting: false,
    clickToRowSelect: false,
    bordered: true,
    showIndexColumn: false,
    pagination: true,
    tableSetting: { fullScreen: true },
    canResize: false,
    showActionColumn: false,
  });
</script>
